function checkForm(f)
{
	var err = '';
	if(f.summ.value == '' || f.summ.value == '0') err += "Введите сумму платежа\n";
	if(f.type)
	{
		var type = f.type.options[f.type.selectedIndex].value;
		if(type)
		{
			if((type == 'buy.drugoy' || type == 'buy.des' || type == 'buy.other') && f.from_people.value == '') err += "Введите \"От кого\"\n";
			if((type == 'sell.drugoy' || type == 'sell.des' || type == 'sell.other') && f.to_people.value == '') err += "Введите \"Кому\"\n";
		}
		else
		{
			err += "Выберите тип платежа";
		}
	}
	if(err)
	{
		alert(err);
		return false;
	}
	return true;
}

function changeType()
{
	var f = document.getElementById('f');
	if(f.type)
	{
		var type = f.type.options[f.type.selectedIndex].value;
		document.getElementById('row_from_user_id').style.display = type == 'buy' ? '' : 'none';
		document.getElementById('row_to_user_id').style.display = type == 'sell' || type == 'reklama' ? '' : 'none';
		document.getElementById('row_from_people').style.display = type == 'buy.drugoy' || type == 'buy.des' || type == 'buy.other' ? '' : 'none';
		document.getElementById('row_to_people').style.display = type == 'sell.drugoy' || type == 'sell.des' || type == 'sell.other' ? '' : 'none';
		document.getElementById('row_komiss').style.display = type == 'komiss' ? 'none' : '';
		document.getElementById('row_date_postup').style.display = type == 'komiss' ? 'none' : '';
	}
}

function changeSchet()
{
	var f = document.getElementById('f');
	if(f.schet_id)
	{
		var schet_id = f.schet_id.options[f.schet_id.selectedIndex].value;
		f.valuta.value = '';
		if(scheta[schet_id])
		{
			f.valuta.value = VALUTA[scheta[schet_id].valuta];
		}
	}
}


